//
//  MyAdapter.swift
//  拾舍清洁
//
//  Created by sky.wei on 2023/2/7.
//

import UIKit

import Alamofire

// MARK: 遵守RequestAdapter 协议
class MyAdapter: RequestAdapter {
    func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {
    }
    
    // 实现adapt 协议方法, 来完成公共参数的配置
    func adapt(_ urlRequest: URLRequest) throws -> URLRequest {
        var request = urlRequest
        // 需要什么就设置什么
        request.setValue("device", forHTTPHeaderField: "iOS")
        request.setValue("vision", forHTTPHeaderField: "1.0.0")
        return request
    }
}
